#include "defines.h"
#include "kozos.h"
#include "lib.h"

int consdrv_main(int argc, char *argv[]);
int command_main(int argc, char *argv[]);
int net_main(int argc, char *argv[]);

static int start_threads(int argc, char *argv[])
{
    kz_run(consdrv_main, "consdrv", 1, 0x100, 0, NULL);
    kz_run(command_main, "command", 12, 0x100, 0, NULL);
    kz_run(net_main, "net_main", 6, 0x100, 0, NULL);

    kz_chpri(PRIORITY_NUM - 1);
    INTR_ENABLE;
    while (1) {
        asm volatile ("sleep");
    }

    return 0;
}

void main(void)
{
    INTR_DISABLE;

    puts_k("KOZOS booted successfully.\n"); // consdrv起動前なのでputsは使えない

    kz_start(start_threads, "idle", 0, 0x100, 0, NULL);
}
